package com.teradata.multithread.chain;

import java.util.concurrent.LinkedBlockingQueue;

/**
 * @Project: edb
 * @Description:
 * @Version 1.0
 * @Throws :
 * @Author: <li>2019/4/23 lyndon Create 1.0
 * @Copyright (c)2018-2018 中央结算公司，版权所有
 * @Modified By:
 */
public class SaveProcessor extends Thread implements RequestProcessor {

    private LinkedBlockingQueue<Request> box = new LinkedBlockingQueue<>();

    public SaveProcessor(){

    }


    @Override
    public void processorRequest(Request request) {
        box.add(request);
    }

    @Override
    public void run() {
        try {
            Request request = box.take();
            System.out.println("save data " + request);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
